package com.free.event;

import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

/**
 * <p>
 * Title: Eclipse Plugin Development
 * </p>
 * <p>
 * Description: Free download
 * </p>
 * <p>
 * mail: ganshm@gmail.com
 * </p>
 */

public class ControlListenerExample
{
    /**
     * Runs the application
     */
    public void run()
    {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.addControlListener(new ControlListener()
        {
            
            public void controlMoved(ControlEvent e)
            {
                // TODO Auto-generated method stub
                System.out.println("control move");
            }
            
            public void controlResized(ControlEvent e)
            {
                // TODO Auto-generated method stub
                System.out.println("control resize");
            }
            
        });
        shell.pack();
        shell.open();
        
        while (!shell.isDisposed())
        {
            if (!display.readAndDispatch())
            {
                display.sleep();
            }
        }
        display.dispose();
    }
    
    /**
     * Application entry point
     * 
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        new ControlListenerExample().run();
    }
}
